<?php /* Smarty version 2.6.25, created on 2012-10-19 06:48:19
         compiled from tpl/subcategoria.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'upper', 'tpl/subcategoria.html', 4, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "tpl/header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?> 
		  	<div id='separa_pagina_header'></div>
			<div id='nombrecategoria_header'>
				<div id='categoria'><?php echo ((is_array($_tmp=$this->_tpl_vars['categoria_nombre'])) ? $this->_run_mod_handler('upper', true, $_tmp) : smarty_modifier_upper($_tmp)); ?>
</div>
				<div id='zonas'>
				
					<select name='select_zonas' id='select_zonas'>
							<option value="0" <?php if ($this->_tpl_vars['zona_id'] == 0): ?>selected='selected'<?php endif; ?> >Todas</option>
							<?php $_from = $this->_tpl_vars['zonas']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['zona']):
?>
							<option value="<?php echo $this->_tpl_vars['zona']->zona_id; ?>
" <?php if ($this->_tpl_vars['zona_id'] == $this->_tpl_vars['zona']->zona_id): ?>selected='selected'<?php endif; ?> ><?php echo $this->_tpl_vars['zona']->nombre; ?>
</option>
							<?php endforeach; endif; unset($_from); ?>
					</select>
				</div>
				<div id='enviar_consulta'><img src='imagenes/boton_consultar.jpg' width='131' height='25' border='0' id='enviar_consulta'></div>
			</div>
		  	<div id='header_preview'></div>
		  	<div id='centro_preview'>
				<div  id='detalle_aviso '>
					<?php $_from = $this->_tpl_vars['registros']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['id_registro'] => $this->_tpl_vars['registro']):
?>
					<div id='nombre_empresa' <?php if ($this->_tpl_vars['registro']['datos']->destacado): ?>style="background:#ebebeb;"<?php endif; ?>  >
						<table width='100%' cellpadding=0 cellspacing=0 border=0>
							<tr>
								<td width='160' rowspan='2'><img src='createthumb.php?src=<?php echo $this->_tpl_vars['registro']['imagen']; ?>
?d=<?php echo $this->_tpl_vars['rand']; ?>
&alto=100' style='width:160px;height:100px;'></td>
								<td valign='top'>
									<div class='titulo_aviso'><?php echo ((is_array($_tmp=$this->_tpl_vars['registro']['datos']->empresa)) ? $this->_run_mod_handler('upper', true, $_tmp) : smarty_modifier_upper($_tmp)); ?>
</div>
									<div class='descripcion_aviso'><?php echo $this->_tpl_vars['registro']['datos']->descripcion_corta; ?>
</div>

								
								</td>
							</tr>
							<tr>
								<td valign='bottom'>
									<div class='bloque'>
									<div class='bloque_left'><a href='aviso.php?id_registro=<?php echo $this->_tpl_vars['registro']['datos']->id_registro; ?>
'>M&Aacute;S INFORMACI&Oacute;N</a></div>
									<div class='bloque_right'><input type='checkbox' id='aviso_<?php echo $this->_tpl_vars['registro']['datos']->id_registro; ?>
' value='<?php echo $this->_tpl_vars['registro']['datos']->id_registro; ?>
' class='checkear'> SELECCIONAR</div>
								</div>
								</td>
							</tr>
						</table>
					</div>

					<div class='calle_horizontal_10'>&nbsp;</div>
					<?php endforeach; endif; unset($_from); ?>
			</div>
			
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "tpl/footer.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?> 
<script type="text/javascript">
    $(document).ready(function() {
	$(".checkear").change(function(){
	    id_registro=$(this).attr('value');
	    if(this.checked){	
			$.ajax({
				type:"GET",
				data:"id_registro="+id_registro,
				url:"agregar_a_consulta.php",
				success: function(data){
					/*var respuesta = confirm('Desea enviar una consulta a los auspiciantes seleccionados?')
					if( respuesta ){
						//location.replace( "enviar_consulta.php" )
						$("#formconsulta").fadeIn();		
						$("#formconsulta").css('top','45%');
					}*/
					}	
				});
		}else{
			$.ajax({
				type:"GET",
				data:"id_registro="+id_registro,
				url:"eliminar_de_consulta.php",
				success: function(data){
					/*
					alert('Se ha eliminado la seleccion');
					var respuesta = confirm('Desea enviar una consulta a los auspiciantes seleccionados?')
					if( respuesta )
					location.replace( "enviar_consulta.php" )
					*/
				}	
			});	
		}	
	});
		/**
		* Zonas
		*/
		$(".zonas_todas").click(function(){
            $('.zona').each(function(){
                zona_id = "zona_" +  $(this).attr('value') 
                $("#" + zona_id).prop('checked',true); 
            })
            
        });

		$(".zonas_ninguna").click(function(){
            $('.zona').each(function(){
                zona_id = "zona_" +  $(this).attr('value') 
                $("#" + zona_id).prop('checked',false); 
            })
            
        });

        $("div.opc_todas ").click(function(){
            cat = $(".opc_todas a ").attr('id') 
            alert('cat')
        })
        
        $('.categorias').click(function(){
            cat = $(this).attr('id') 
            //alert(cat);
            if($(this).is(':checked') ){
                $('#sub' + cat).css('display','block');
            }else{
                $('#sub' + cat).css('display','none');
            }
            /**
             * mostrar subcategorias
             */
        });
        
        /**
         * Seleccionar todas
         */
        $(".opc_todas").click(function(){
            cat = $(this).attr('valor')
            $('#subcat_' + cat + " input ").each(function(){
                subcategoria = "subcategoria_" +  $(this).attr('value') 
                $("#" + subcategoria).prop('checked',true); 
            })
            
        });
        
        /**
         * Deseleccionar
         */
        $(".opc_ninguna").click(function(){
            cat = $(this).attr('valor')
            $('#subcat_' + cat + " input ").each(function(){
                subcategoria = "subcategoria_" +  $(this).attr('value') 
                $("#" + subcategoria).prop('checked',false); 
            })
            
        });
        
    })
</script>        